from re_common.baselibrary.utils.ydmhttp import YDMHttp
import requests


#

# pytest ydm_test.py::ydm_test -s
def ydm_test():
    y = YDMHttp()

    r = requests.get('http://kdoc.cnki.net/kdoc/request/ValidateCode.ashx')

    with open('code.jpg', mode='wb') as f:
        f.write(r.content)

    v = y.Img2Code(r.content, codetype='1004')
    print(v)


if __name__ == '__main__':
    ydm_test()
